<template>
  <div class="app-container">
    <el-card style="border-radius: 10px">
      <el-form v-show="showSearch" ref="queryForm" :inline="true" :model="queryParams" label-width="100px" size="small">
        <el-form-item label="报工类型" prop="feedbackType">
          <el-select v-model="queryParams.feedbackType" clearable placeholder="请选择报工类型">
            <el-option v-for="dict in dict.type.mes_feedback_type" :key="dict.value" :label="dict.label" :value="dict.value" />
          </el-select>
        </el-form-item>
        <el-form-item label="工作站名称" prop="workstationName">
          <el-input v-model="queryParams.workstationName" clearable placeholder="请输入工作站名称" @keyup.enter.native="handleQuery" />
        </el-form-item>
        <el-form-item label="生产工单编号" prop="workorderCode">
          <el-input v-model="queryParams.workorderCode" clearable placeholder="请输入生产工单编号" @keyup.enter.native="handleQuery" />
        </el-form-item>
        <el-form-item label="产品物料编码" prop="itemCode">
          <el-input v-model="queryParams.itemCode" clearable placeholder="请输入产品物料编码" @keyup.enter.native="handleQuery" />
        </el-form-item>
        <el-form-item label="产品物料名称" prop="itemName">
          <el-input v-model="queryParams.itemName" clearable placeholder="请输入产品物料名称" @keyup.enter.native="handleQuery" />
        </el-form-item>
        <el-form-item label="报工人" prop="nickName">
          <el-input v-model="queryParams.nickName" clearable placeholder="请输入报工人名称" @keyup.enter.native="handleQuery" />
        </el-form-item>
        <el-form-item label="审核人" prop="recordNick">
          <el-input v-model="queryParams.recordNick" clearable placeholder="请输入审核人" @keyup.enter.native="handleQuery" />
        </el-form-item>
        <el-form-item label="状态" prop="status">
          <el-select v-model="queryParams.status" clearable placeholder="请选择状态">
            <el-option v-for="dict in dict.type.mes_order_status" :key="dict.value" :label="dict.label" :value="dict.value" />
          </el-select>
        </el-form-item>
        <el-form-item>
          <el-button icon="el-icon-search" size="mini" type="primary" @click="handleQuery">搜索</el-button>
          <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
        </el-form-item>
      </el-form>
    </el-card>
    <div style="height: 15px"></div>
    <el-card style="border-radius: 10px">
      <!--      <el-row :gutter="10" class="mb8">
              <el-col :span="1.5">
                <el-button v-hasPermi="['mes:pro:feedback:add']" icon="el-icon-plus" size="mini" type="primary" @click="handleAdd">新增</el-button>
              </el-col>
              <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
            </el-row>-->
      <el-table v-loading="loading" :data="feedbackList" border @selection-change="handleSelectionChange">
        <el-table-column align="center" label="报工类型" prop="feedbackType" width="120px">
          <template slot-scope="scope">
            <dict-tag :options="dict.type.mes_feedback_type" :value="scope.row.feedbackType" />
          </template>
        </el-table-column>
        <el-table-column :show-overflow-tooltip="true" align="center" label="工作站" prop="workstationName" width="120px" />
        <el-table-column :show-overflow-tooltip="true" align="center" label="生产工单编号" prop="workorderCode" width="150px" />
        <el-table-column :show-overflow-tooltip="true" align="center" label="产品物料编码" prop="itemCode" width="150px" />
        <el-table-column :show-overflow-tooltip="true" align="center" label="产品物料名称" prop="itemName" width="150px" />
        <el-table-column align="center" label="规格型号" prop="specification" />
        <el-table-column align="center" label="报工数量" prop="quantityFeedback">
          <template slot-scope="scope">
            <el-tag type="primary">{{ scope.row.quantityFeedback }}</el-tag>
          </template>
        </el-table-column>
        <el-table-column align="center" label="合格品数量" prop="quantityQualified" width="100px">
          <template slot-scope="scope">
            <el-tag type="success">{{ scope.row.quantityQualified }}</el-tag>
          </template>
        </el-table-column>
        <el-table-column align="center" label="不良品数量" prop="quantityUnquanlified" width="100px">
          <template slot-scope="scope">
            <el-tag type="danger">{{ scope.row.quantityUnquanlified }}</el-tag>
          </template>
        </el-table-column>
        <el-table-column align="center" label="报工人" prop="nickName">
          <template slot-scope="scope">
            <el-tag>{{ scope.row.nickName }}</el-tag>
          </template>
        </el-table-column>
        <el-table-column align="center" label="报工时间" prop="feedbackTime" width="180">
          <template slot-scope="scope">
            <span>{{ parseTime(scope.row.feedbackTime, '{y}-{m}-{d}') }}</span>
          </template>
        </el-table-column>
        <el-table-column align="center" label="审核人" prop="recordNick" />
        <el-table-column align="center" fixed="right" label="状态" prop="status">
          <template slot-scope="scope">
            <dict-tag :options="dict.type.mes_order_status" :value="scope.row.status" />
          </template>
        </el-table-column>
        <el-table-column align="center" fixed="right" label="操作" width="180px">
          <template slot-scope="scope">
            <el-button v-hasPermi="['mes:pro:feedback:query']" icon="el-icon-view" size="mini" type="text" @click="handleInfoView(scope.row)">查看</el-button>
            <el-button v-if="scope.row.status === 'PREPARE'" v-hasPermi="['mes:pro:feedback:tijiao']" icon="el-icon-edit" size="mini" type="text" @click="handleUpdate(scope.row)">
              编辑
            </el-button>
            <el-button v-if="scope.row.status == 'PREPARE'" v-hasPermi="['mes:pro:feedback:remove']" icon="el-icon-delete" size="mini" type="text" @click="handleDelete(scope.row)">
              删除
            </el-button>
          </template>
        </el-table-column>
      </el-table>

      <pagination v-show="total > 0" :limit.sync="queryParams.pageSize" :page.sync="queryParams.pageNum" :total="total" @pagination="getList" />
    </el-card>
    <!-- 添加或修改生产报工记录对话框 -->
    <el-dialog :title="title" :visible.sync="open" append-to-body width="960px">
      <el-form ref="form" :model="form" :rules="rules" label-width="100px">
        <el-row>
          <el-col :span="8">
            <el-form-item label="报工类型" prop="feedbackType">
              <el-select v-model="form.feedbackType" :disabled="form.status === 'PREPARE' ? false : true" placeholder="请选择报工类型">
                <el-option v-for="dict in dict.type.mes_feedback_type" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="生产工单" prop="workorderCode">
              <el-input v-model="form.workorderCode" :disabled="form.status === 'PREPARE' ? false : true" placeholder="请选择生产工单">
                <el-button slot="append" :disabled="form.status === 'PREPARE' ? false : true" icon="el-icon-search" @click="handleWorkorderSelect"></el-button>
              </el-input>
            </el-form-item>
            <WorkorderSelect ref="woSelect" @onSelected="onWorkorderSelected"></WorkorderSelect>
          </el-col>
          <el-col :span="8">
            <el-form-item label="生产任务" prop="taskCode">
              <el-input v-model="form.taskCode" :disabled="form.status === 'PREPARE' ? false : true" placeholder="请选择生产任务">
                <el-button slot="append" :disabled="form.status === 'PREPARE' ? false : true" icon="el-icon-search" @click="handleTaskSelect"></el-button>
              </el-input>
            </el-form-item>
            <ProtaskSelect ref="taskSelect" :taskStatus="taskStatus" :workorderId="form.workorderId" @onSelected="onTaskSelected"></ProtaskSelect>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="8">
            <el-form-item label="产品编码" prop="itemCode">
              <el-input v-model="form.itemCode" disabled />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="产品名称" prop="itemName">
              <el-input v-model="form.itemName" disabled />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="单位" prop="unitOfMeasure">
              <el-input v-model="form.unitOfMeasure" disabled />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="8">
            <el-form-item label="计价方式" prop="pricingMethod">
              <el-select v-model="form.pricingMethod" disabled placeholder="请选择来计价方式">
                <el-option v-for="dict in dict.type.pro_pricing_method" :key="dict.value" :disabled="true" :label="dict.label" :value="dict.value" />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col v-if="form.pricingMethod == 'PIECEWORK'" :span="8">
            <el-form-item label="标准计件单价" prop="price">
              <el-input v-model="form.price" disabled placeholder="请输入单价" />
            </el-form-item>
          </el-col>
          <el-col v-else-if="form.pricingMethod == 'TIME'" :span="8">
            <el-form-item label="标准计时单价" prop="price">
              <el-input v-model="form.price" disabled placeholder="请输入单价" />
            </el-form-item>
          </el-col>
          <el-col v-if="form.pricingMethod == 'TIME'" :span="8">
            <el-form-item label="工作时长" prop="workingHours">
              <el-input-number v-model="form.workingHours" :min="1" :step="1" placeholder="请输入工作时长" />
            </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col :span="24">
            <el-form-item label="规格型号" prop="specification">
              <el-input v-model="form.specification" disabled type="textarea" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row v-if="form.isCheck == 'N'">
          <el-col :span="8">
            <el-form-item label="报工数量" prop="quantityFeedback">
              <el-input v-model="form.quantityFeedback" :disabled="form.status === 'PREPARE' ? false : true" disabled />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="合格品数量" prop="quantityQualified">
              <el-input-number
                v-model="form.quantityQualified"
                :disabled="form.status === 'PREPARE' ? false : true"
                :min="0"
                placeholder="请输入合格品数量"
                @change="handleQuantityChanged"
              />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="不良品数量" prop="quantityUnquanlified">
              <el-input-number
                v-model="form.quantityUnquanlified"
                :disabled="form.status === 'PREPARE' ? false : true"
                :min="0"
                placeholder="请输入不良品数量"
                @change="handleQuantityChanged"
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row v-else>
          <el-col :span="8">
            <el-form-item label="报工数量" prop="quantityFeedback">
              <el-input v-model="form.quantityFeedback" disabled />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="待检测数量" prop="quantityUncheck">
              <el-input-number
                v-model="form.quantityUncheck"
                :disabled="form.status === 'PREPARE' ? false : true"
                :min="0"
                placeholder="请输入待检测数量"
                @change="handleQuantityChanged"
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="8">
            <el-form-item label="报工人" prop="nickName">
              <el-input v-model="form.nickName" disabled placeholder="请选择报工人"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="报工时间" prop="feedbackTime">
              <el-date-picker
                v-model="form.feedbackTime"
                :disabled="form.status === 'PREPARE' ? false : true"
                clearable
                placeholder="请选择报工时间"
                type="date"
                value-format="yyyy-MM-dd"
              ></el-date-picker>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label="备注" prop="remark">
              <el-input v-model="form.remark" placeholder="请输入内容" type="textarea" />
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>

      <el-tabs v-if="qcIpqc != null && qcIpqc.ipqcId != null" type="border-card">
        <el-tab-pane label="检验单信息">
          <el-descriptions :column="2" border>
            <el-descriptions-item content-style="margin-bottom: 20px; margin-top: 20px;" label="检验单名称" label-style="margin-bottom: 20px; margin-top: 20px;">
              {{ qcIpqc.ipqcName }}
            </el-descriptions-item>
            <el-descriptions-item content-style="margin-bottom: 20px; margin-top: 20px;" label="检验单编号" label-style="margin-bottom: 20px; margin-top: 20px;">
              {{ qcIpqc.ipqcCode }}
            </el-descriptions-item>
            <el-descriptions-item content-style="margin-bottom: 20px; margin-top: 20px;" label="检验类型" label-style="margin-bottom: 20px; margin-top: 20px;">
              {{ qcIpqc.ipqcType }}
            </el-descriptions-item>
            <el-descriptions-item content-style="margin-bottom: 20px; margin-top: 20px;" label="检验日期" label-style="margin-bottom: 20px; margin-top: 20px;">
              {{ qcIpqc.inspectDate }}
            </el-descriptions-item>
            <el-descriptions-item content-style="margin-bottom: 20px; margin-top: 20px;" label="检验人" label-style="margin-bottom: 20px; margin-top: 20px;">
              {{ qcIpqc.inspector }}
            </el-descriptions-item>
          </el-descriptions>
        </el-tab-pane>
        <el-tab-pane label="检验项目">
          <div class="info-container">
            <el-card v-if="qcIpqc.ipqcId != null" class="box-card" shadow="always">
              <IpqcSelect ref="line" :ipqcId="qcIpqc.ipqcId" :optType="optType"></IpqcSelect>
            </el-card>
          </div>
        </el-tab-pane>
        <el-tab-pane label="检验结果">
          <el-descriptions :column="2" border>
            <el-descriptions-item content-style="margin-bottom: 20px; margin-top: 20px;" label="合格数量" label-style="margin-bottom: 20px; margin-top: 20px;">
              {{ qcIpqc.quantityQualified }}
            </el-descriptions-item>
            <el-descriptions-item content-style="margin-bottom: 20px; margin-top: 20px;" label="不合格数量" label-style="margin-bottom: 20px; margin-top: 20px;">
              {{ qcIpqc.quantityUnqualified }}
            </el-descriptions-item>
            <el-descriptions-item content-style="margin-bottom: 20px; margin-top: 20px;" label="合格率" label-style="margin-bottom: 20px; margin-top: 20px;">
              {{ ((qcIpqc.quantityQualified / (qcIpqc.quantityCheck + qcIpqc.quantityUnqualified)) * 100).toFixed(2) }}%
            </el-descriptions-item>
            <el-descriptions-item content-style="margin-bottom: 20px; margin-top: 20px;" label="检测结果" label-style="margin-bottom: 20px; margin-top: 20px;">
              {{ qcIpqc.checkResult == 'ACCEPT' ? '检验通过' : '检验不通过' }}
            </el-descriptions-item>
            <el-descriptions-item content-style="margin-bottom: 20px; margin-top: 20px;" label="备注" label-style="margin-bottom: 20px; margin-top: 20px;">
              {{ qcIpqc.remark }}
            </el-descriptions-item>
          </el-descriptions>
        </el-tab-pane>
      </el-tabs>

      <div slot="footer" class="dialog-footer">
        <el-button v-if="optType == 'view' || form.status != 'PREPARE'" type="primary" @click="cancel">返回</el-button>
        <el-button v-if="form.status == 'PREPARE' && optType != 'view'" type="primary" @click="submitForm">保 存</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>

    <feedback-info v-if="infoOpen" ref="feedbackInfo"></feedback-info>
  </div>
</template>

<script>
import { addFeedback, delFeedback, getFeedback, listFeedback, updateFeedback } from '@/api/mes/rr/rrfeedback'
import WorkorderSelect from '@/components/workorderSelect/single.vue'
import WorkstationSelect from '@/components/workstationSelect/simpletableSingle.vue'
import UserSingleSelect from '@/components/userSelect/single.vue'
import ProtaskSelect from '@/components/TaskSelect/taskSelectSingle.vue'
import FeedbackInfo from '@/views/mes/rr/returnrepairfeedback/feedbackInfo.vue'
import IpqcSelect from '@/components/ipqcSelect/single.vue'
import ProTask from '@/views/mes/pro/workticket/task/proTask.vue'

export default {
  name: 'Feedback',
  components: {
    ProTask,
    IpqcSelect,
    WorkorderSelect,
    WorkstationSelect,
    UserSingleSelect,
    ProtaskSelect,
    FeedbackInfo
  },
  dicts: ['mes_order_status', 'mes_feedback_type', 'pro_pricing_method'],
  data() {
    return {
      optType: undefined,
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 生产报工记录表格数据
      feedbackList: [],
      // 弹出层标题
      title: '',
      // 是否显示弹出层
      open: false,

      infoOpen: false,

      taskStatus: 'PROGRESS',

      isSubmit: true,

      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        feedbackType: null,
        workstationId: null,
        workstationCode: null,
        workstationName: null,
        workorderId: null,
        workorderCode: null,
        workorderName: null,
        taskId: null,
        taskCode: null,
        itemId: null,
        itemCode: null,
        itemName: null,
        unitOfMeasure: null,
        specification: null,
        quantity: null,
        quantityFeedback: null,
        quantityQualified: null,
        quantityUnquanlified: null,
        userName: null,
        nickName: null,
        feedbackChannel: null,
        feedbackTime: null,
        recordUser: null,
        recordNick: null,
        status: null
      },
      // 表单参数
      form: {},

      qcIpqc: {},
      // 表单校验
      rules: {
        feedbackType: [{ required: true, message: '报工类型不能为空', trigger: 'change' }],
        taskCode: [{ required: true, message: '请选择生产任务', trigger: 'blur' }],
        workorderCode: [{ required: true, message: '生产工单不能为空', trigger: 'blur' }],
        nickName: [{ required: true, message: '请选择报工人', trigger: 'blur' }],
        feedbackTime: [{ required: true, message: '请选择报工时间', trigger: 'blur' }]
      }
    }
  },
  created() {
    this.getList()
  },
  methods: {
    /** 查询生产报工记录列表 */
    getList() {
      this.loading = true
      listFeedback(this.queryParams).then((response) => {
        this.feedbackList = response.rows
        this.total = response.total
        this.loading = false
      })
    },
    // 取消按钮
    cancel() {
      this.open = false
      this.reset()
    },
    // 表单重置
    reset() {
      this.form = {
        recordId: null,
        feedbackType: null,
        workstationId: null,
        workstationCode: null,
        workstationName: null,
        routeId: null,
        routeCode: null,
        processId: null,
        processCode: null,
        processName: null,
        workorderId: null,
        workorderCode: null,
        workorderName: null,
        taskId: null,
        taskCode: null,
        taskName: null,
        itemId: null,
        itemCode: null,
        itemName: null,
        specification: null,
        quantity: 0,
        quantityUncheck: 0,
        quantityFeedback: 0,
        quantityQualified: 0,
        quantityUnquanlified: 0,
        userName: null,
        nickName: null,
        feedbackChannel: null,
        feedbackTime: new Date(),
        recordUser: null,
        recordNick: null,
        status: 'PREPARE',
        remark: null,
        attr1: null,
        attr2: null,
        attr3: null,
        attr4: null,
        createBy: null,
        createTime: null,
        updateBy: null,
        updateTime: null,
        workingHours: 1,
        isPra: null
      }
      this.resetForm('form')
      this.qcIpqc = {}
    },
    handleQuantityChanged() {
      this.form.quantityFeedback = this.form.quantityQualified + this.form.quantityUnquanlified + this.form.quantityUncheck
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1
      this.getList()
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm('queryForm')
      this.handleQuery()
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map((item) => item.recordId)
      this.single = selection.length !== 1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset()
      this.open = true
      this.title = '添加生产报工记录'
      this.optType = 'add'
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset()
      const recordId = row.recordId || this.ids
      if (row.status == 'APPROVING') {
        getFeedbackInfo(recordId).then((response) => {
          this.qcIpqc = response.data.qcIpqc || this.qcIpqc
        })
      }

      getFeedback(recordId).then((response) => {
        this.form = response.data
        this.open = true
        this.isSubmit = true
        this.title = '修改生产报工记录'
        this.optType = 'edit'
      })
    },
    // 查询明细按钮操作
    handleView(row) {
      this.reset()
      const recordId = row.recordId || this.ids
      getFeedback(recordId).then((response) => {
        this.form = response.data
        this.open = true
        this.title = '查看生产报工单信息'
        this.optType = 'view'
      })
    },
    // 查询明细按钮操作
    handleInfoView(row) {
      const recordId = row.recordId || this.ids
      this.infoOpen = true
      this.$nextTick(() => {
        this.$refs.feedbackInfo.init(recordId)
      })
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs['form'].validate((valid) => {
        if (valid) {
          if (this.form.recordId != null) {
            updateFeedback(this.form).then((response) => {
              this.$modal.msgSuccess('修改成功')
              this.open = false
              this.getList()
            })
          } else {
            addFeedback(this.form).then((response) => {
              this.$modal.msgSuccess('新增成功')
              this.open = false
              this.getList()
            })
          }
        }
      })
    },
    handleSubmit() {
      this.$refs['form'].validate((valid) => {
        if (valid) {
          if (this.form.recordId != null) {
            this.isSubmit = false
            this.form.status = 'APPROVING'
            updateFeedback(this.form)
              .then((response) => {
                this.$modal.msgSuccess('提交成功')
                this.open = false
                this.getList()
              })
              .catch(() => {
                this.form.status = 'PREPARE'
              })
          }
        }
      })
    },
    //审批通过执行
    handleExecute() {
      const data = this.form
      this.$modal
        .confirm('是否确认报工审核完成？审核后不可更改！')
        .then(function () {
          return execute(data) //执行报工
        })
        .then(() => {
          this.getList()
          this.$modal.msgSuccess('执行成功')
          this.open = false
        })
        .catch(() => {})
    },
    //审批不通过，拒绝
    handleReject() {
      this.form.status = 'PREPARE'
      if (this.form.isCheck === 'Y') {
        this.form.quantityUncheck = this.form.quantityFeedback
      }
      if (this.form.recordId != null) {
        updateFeedback(this.form).then((response) => {
          this.$modal.msgSuccess('提交成功')
          this.open = false
          this.getList()
        })
      }
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const recordIds = row.recordId || this.ids
      this.$modal
        .confirm('是否确认删除生产报工记录编号为"' + recordIds + '"的数据项？')
        .then(function () {
          return delFeedback(recordIds)
        })
        .then(() => {
          this.getList()
          this.$modal.msgSuccess('删除成功')
        })
        .catch(() => {})
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download(
        'pro/feedback/export',
        {
          ...this.queryParams
        },
        `feedback_${new Date().getTime()}.xlsx`
      )
    },
    //选择生产工单
    handleWorkorderSelect() {
      this.$refs.woSelect.showFlag = true
    },
    onWorkorderSelected(row) {
      if (row != undefined && row != null) {
        this.form.workorderId = row.workorderId
        this.form.workorderCode = row.workorderCode
        this.form.workorderName = row.workorderName
        this.form.itemId = row.productId
        this.form.itemCode = row.productCode
        this.form.itemName = row.productName
        this.form.specification = row.productSpc
        this.form.unitOfMeasure = row.unitOfMeasure
      }
    },
    handleTaskSelect() {
      this.$refs.taskSelect.showFlag = true
      this.$refs.taskSelect.getList()
    },
    onTaskSelected(row) {
      if (row != undefined && row != null) {
        this.form.taskId = row.taskId
        this.form.taskCode = row.taskCode
        this.form.taskName = row.taskName
        this.form.workstationId = row.workstationId
        this.form.workstationCode = row.workstationCode
        this.form.workstationName = row.workstationName
        this.form.processId = row.processId
        this.form.processCode = row.processCode
        this.form.processName = row.processName
        this.form.routeId = row.routeId
        this.form.routeCode = row.routeCode
        this.form.isCheck = row.isCheck
        this.form.nickName = row.attr1
        this.form.userName = row.attr3
        this.form.pricingMethod = row.pricingMethod
        this.form.price = row.price
        this.form.isPra = row.isPra
        if (row.isCheck == 'N') {
          this.form.quantityUncheck = 0
        } else {
          this.form.quantityQualified = 0
          this.form.quantityUnquanlified = 0
        }
      }
    },
    //点击人员选择按钮
    handleUserSelect() {
      this.$refs.userSelect.showFlag = true
    },
    //人员选择返回
    onUserSelected(row) {
      this.form.nickName = row.nickName
      this.form.userName = row.userName
    },
    //点击人员选择按钮
    handleUser2Select() {
      this.$refs.user2Select.showFlag = true
    },
    //人员选择返回
    onUser2Selected(row) {
      this.form.recordUser = row.userName
      this.form.recordNick = row.nickName
    }
  }
}
</script>
<style scoped>
.production-info {
  border: 1px solid #ddd;
  padding: 16px;
  border-radius: 4px;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.details {
  flex-grow: 1;
  margin-left: 16px;
}

.status {
  margin-left: 16px;
}

.status-text {
  color: orange;
  border: 1px solid orange;
  padding: 4px 8px;
  border-radius: 4px;
}

.content {
  margin-top: 16px;
}
</style>
